package jp.ac.waseda.cs.washi.game.entity;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import jp.ac.waseda.cs.washi.gameaiarena.api.Point2;

public enum MassSpellType {
	/**
	 * 単体魔法
	 */
	SingleType(new int[][] {
			{0, 0, 0},
			{0, 1, 0},
			{0, 0, 0},
	}),
	/**
	 * 範囲魔法1
	 */
	CrossType(new int[][] {
			{0, 1, 0},
			{1, 0, 1},
			{0, 1, 0},
	}),

	/**
	 * 範囲魔法2
	 */
	DiagonalType(new int[][] {
			{1, 0, 1},
			{0, 1, 0},
			{1, 0, 1},
	});

	private final List<Point2> _spellPoints;

	private MassSpellType(int[][] shape) {
		ArrayList<Point2> spellList = new ArrayList<Point2>();

		for (int i = 0; i < shape.length; i++) {
			for (int j = 0; j < shape[i].length; j++) {
				if (shape[i][j] == 1) {
					Point2 p = new Point2(i - shape.length/2, j - shape[i].length/2);
					spellList.add(p);
				}
			}
		}

		_spellPoints = Collections.unmodifiableList(spellList);
	}

	public List<Point2> getSpellPoints() {
		return _spellPoints;
	}
}
